﻿//单向链表库
//copyright (c) 2016 L.W.C.<lwc@li.cm>

#include <stdlib.h>
#include "vxin.h"

#ifndef vxin_slistlib
	#define vxin_slistlib 1

	typedef unsigned int uint;

	struct ___Slist__temp{
		void* ptr;
		uint id;
		struct ___Slist__temp *next;
	};

	/*
			数据结果设计为一个指针和一个id，指针为了方便存入其他格式数据
	*/

	typedef struct ___Slist__temp vxin_slist;

	vxin_slist* SLIST_New(void* ptr,uint id);
	void SLIST_Destroy(vxin_slist* slist);
	vxin_slist* SLIST_GetById(vxin_slist *slist,uint id);
	vxin_slist* SLIST_GetByPtr(vxin_slist *slist,void* ptr,int (*fun)(void*ptrA,void*ptrB));
	vxin_slist* SLIST_GetByIndex(vxin_slist *slist,uint index);
	vxin_slist* SLIST_Push(vxin_slist *slist,void* ptr,uint id);
	vxin_slist* SLIST_Pop(vxin_slist *slist,void** ptr,uint* id);
	vxin_slist* SLIST_GetEnd(vxin_slist *slist);

#endif